import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import HomeView from "../views/HomeView.vue";
import AdminView from "@/views/AdminView.vue";
import NoAuthorView from "@/views/NoAuthorView.vue";
import ACCESS_ENUM from "@/access/accessEnum";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "浏览模块",
    component: HomeView,
  },
  {
    path: "/hide",
    name: "隐藏页面",
    component: HomeView,
    meta: {
      hideMenu: true,
    },
  },
  {
    path: "/admin",
    name: "管理员权限",
    component: AdminView,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/no",
    name: "无权限",
    component: NoAuthorView,
  },
  {
    path: "/about",
    name: "关于我的",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
